from typing import Optional, List
from pydantic import BaseModel, Field
from datetime import datetime


class BaseSchema(BaseModel):
    class Config:
        allow_population_by_field_name = True
        alias_generator = lambda x: ''.join(word.capitalize() if i else word for i, word in enumerate(x.split('_')))


pass


class SysRoleMenuBase(BaseSchema):
    pass


class SysRoleMenuCreate(SysRoleMenuBase):
    pass


class SysRoleMenuUpdate(SysRoleMenuBase):
    pass


class SysRoleMenuDelete(BaseModel):
    ids: List[int] = Field(..., description="角色和菜单关联表ID列表")


class PageParams(BaseSchema):
    page_num: int = Field(1, ge=1, alias="pageNum", description="页码")
    page_size: int = Field(10, ge=1, le=100, alias="pageSize", description="每页数量")
